<template>
  <el-dialog :title="title" :visible.sync="dialogFormVisible">
    <el-form :model="form">
      <el-form-item label="靓号" :label-width="formLabelWidth">
        <el-input v-model="form.idNumber" placeholder="请输入靓号"></el-input>
      </el-form-item>
      <el-form-item label="是否为靓号" :label-width="formLabelWidth">
        <el-radio-group v-model="form.isNumber">
          <el-radio :label="0">不是</el-radio>
          <el-radio :label="1">是</el-radio>
        </el-radio-group>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="mit">取 消</el-button>
      <el-button type="primary" @click="onSubmit">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import {updateIdnumber} from "@/api/user/user"
export default {
  data() {
    return{
      title:'设置靓号',
      dialogFormVisible:false,
      formLabelWidth: '120px',
      options: [],
      form: {
        isNumber:0,
        idNumber: undefined,
        userid: undefined
      },
    }
  },
  methods:{
    async onSubmit(){
      if(!this.form.idNumber){
        this.$message({
          message: '请输入靓号',
          type: 'warning'
        });
        return;
      }

      await updateIdnumber(this.form)
      this.$message({
        type: 'success',
        message: '修改成功'
      });
      this.$emit('success')
      this.dialogFormVisible = false
      this.setForm()
    },
    setForm(){
      this.form.isNumber=0
      this.form.idNumber=undefined
      this.form.userid = undefined
    },
    open(userid){
      this.form.userid = userid
      this.dialogFormVisible = true
      this.getissueCardList()
    },
    mit(){
      this.dialogFormVisible = false
      this.setForm()
    }
  }
}
</script>
<style scoped lang="scss">

</style>
